package edu.sctu.zhangwang.month201506;

/**
 * Created by Administrator on 2015/6/7.
 */
public class TestThreed extends Thread{
    String name;
    public TestThreed(String name){
        this.name = name;
    }

    public void outActor(){


        System.out.println(name+"演员登场。。。。。");

        int count = 0;

        boolean p = true;
        while (p){
//            System.out.println(name+"登场演出！");
            System.out.println(name+"登场的次数："+(++count));
            if (count == 100){
                p = false;
            }
            if (count%10 == 0){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
        System.out.println("演出结束!!!!!");
    }
    public void outActorOther(){
        String name1 = "武则天";
        System.out.println(name1+"演员登场。。。。。");

        int count = 0;

        boolean p = true;
        while (p){
//            System.out.println(name+"登场演出！");
            System.out.println(name1+"登场的次数："+(++count));
            if (count == 100){
                p = false;
            }
            if (count%10 == 0){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
        System.out.println("演出结束!!!!!");
        Thread.activeCount();
    }

    public static void main(String[] args) {
        TestThreed testThreed = new TestThreed("张飞");
        testThreed.outActor();
        testThreed.outActorOther();
    }
}
